// 浮点数精度 height - medium - lowp ( 放在最前面，告知计算机应该如何计算浮点数 )
precision lowp float;

uniform float uPointSize;
uniform float uTime;

varying vec3 vColor;

void main(){
    vec4 modulePosition = modelMatrix * vec4(position,1.0);



    // 获取点的角度
    float angle = atan( modulePosition.x,modulePosition.z );
    // 获取顶点到中心的距离
    float distanceToCenter = length( modulePosition.xz );
    // 根据顶点到中心的距离，设置旋转偏移度数
    float offset = 1.0/distanceToCenter*uTime;
    // 目前角度 + 偏移角度
    angle+=offset;

    modulePosition.x = cos(angle) * distanceToCenter;
    modulePosition.z = sin(angle) * distanceToCenter;

    vec4 viewPosition = viewMatrix * modulePosition;
    gl_Position = projectionMatrix * viewPosition;
    gl_PointSize = uPointSize / -viewPosition.z ;

    vColor = color;
}